<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>组件切换一</title>
</head>

<body>
    <div id="app">
        <a href="" @click.prevent="flag=true">登录</a>
        <a href="" @click.prevent="flag=false">注册</a>
        <sign v-if="flag"></sign>
        <register v-else></register>
    </div>
    <template id="tem1">
        <h2>登录组件页面</h2>
    </template>
    <template id="tem2">
        <h2>注册组件页面</h2>
    </template>
</body>

</html>
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
<script>
    Vue.component('sign', {
        template: "#tem1"
    });
    Vue.component('register', {
        template: "#tem2"
    })
    new Vue({
        el: "#app",
        data: {
            flag: true
        }
    })
</script>